﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Printer
{
    public partial class Printer : Form
    {

        private string location;
        private List<string> files;

        public Printer()
        {
            InitializeComponent();
        }

        private void ordnerÖffnenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            locationBrowser.ShowDialog();

            location = locationBrowser.SelectedPath;

            txt_folderLocation.Text = location;

            

        }

        private void btn_search_Click(object sender, EventArgs e)
        {
            LocationScan scan = new LocationScan(location);
            files = scan.getFiles();

            foreach (string file in files)
            {
                foundFiles.Items.Add(file);
            }
        }

        private void btn_print_Click(object sender, EventArgs e)
        {
            foreach (string file in files)
            {
                var prtProc = new Process();
                prtProc.StartInfo.FileName = file;
                prtProc.StartInfo.UseShellExecute = true;
                prtProc.StartInfo.Verb = "print";
                prtProc.Start();
            }
            
        }
    }
}
